<template>
  <div id="contentBox">
    <div class="searchBox">
      <el-form :inline="true" ref="searchForm" :model="searchForm" label-width="105px">
        <el-form-item label="注册日期起" prop="startDate">
          <el-date-picker :editable="false" v-model="searchForm.startDate" type="date" placeholder="选择日期" :picker-options="startDateOpt"
            @change="debounceSeach">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="注册日期止" prop="endDate">
          <el-date-picker :editable="false" v-model="searchForm.endDate" type="date" placeholder="选择日期" :picker-options="endDateOpt"
            @change="debounceSeach">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="经销商名称" prop="name">
          <el-input v-model="searchForm.name" placeholder="请输入搜索内容..." @input.native="debounceSeach">
          </el-input>
        </el-form-item>
        <el-form-item label="使用者姓名" prop="person">
          <el-input v-model="searchForm.person" placeholder="请输入搜索内容..." @input.native="debounceSeach">
          </el-input>
        </el-form-item>

        <el-form-item label="实名认证日期起" prop="realNameAuthStartDate">
          <el-date-picker :editable="false" v-model="searchForm.realNameAuthStartDate" type="date" placeholder="选择日期" :picker-options="startDateOpt"
            @change="debounceSeach">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="实名认证日期止" prop="realNameAuthEndDate">
          <el-date-picker :editable="false" v-model="searchForm.realNameAuthEndDate" type="date" placeholder="选择日期" :picker-options="realNameAuthEndDateOpt"
            @change="debounceSeach">
          </el-date-picker>
        </el-form-item>

        <el-form-item label="企业认证日期起" prop="authStartDate">
          <el-date-picker :editable="false" v-model="searchForm.authStartDate" type="date" placeholder="选择日期" :picker-options="startDateOpt"
            @change="debounceSeach">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="企业认证日期止" prop="authEndDate">
          <el-date-picker :editable="false" v-model="searchForm.authEndDate" type="date" placeholder="选择日期" :picker-options="authEndDateOpt"
            @change="debounceSeach">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="手机号码" prop="phone">
          <el-input v-model="searchForm.phone" placeholder="请输入搜索内容..." @input.native="debounceSeach">
          </el-input>
        </el-form-item>
        <el-form-item label="手机号归属省市" prop="searchCity">
          <el-input v-model="searchForm.searchCity" placeholder="请输入搜索内容..." @input.native="debounceSeach">
          </el-input>
        </el-form-item>
        <el-form-item label="用户来源" prop="source">
          <el-select v-model="searchForm.source" placeholder="请选择" @change="debounceSeach">
            <el-option label="请选择用户来源" value=""></el-option>
            <el-option v-for="(item, index) in statusMap" :label="item" :value="index" :key="index"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="补充资料有无" prop="isData">
          <el-select v-model="searchForm.isData" placeholder="请选择" @change="debounceSeach">
            <el-option label="请选择补充资料" value=""></el-option>
            <el-option v-for="(item, index) in dealerData" :label="item" :value="index" :key="index"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否启用" prop="enable">
          <el-select v-model="searchForm.enable" placeholder="请选择" @change="debounceSeach">
            <el-option label="请选择否启用" value=""></el-option>
            <el-option v-for="(item, index) in dealerEnable" :label="item" :value="index" :key="index"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="经销商类别" prop="category">
          <el-select v-model="searchForm.category" placeholder="请选择" @change="debounceSeach">
            <el-option label="请选择经销商类别" value=""></el-option>
            <el-option v-for="(item, index) in type" :label="item" :value="index" :key="index"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="业务员" prop="realname">
          <el-input v-model="searchForm.realname" placeholder="请输入搜索内容..." @input.native="debounceSeach">
          </el-input>
          </el-select>
        </el-form-item>
        <el-form-item style=" margin-bottom: 10px;">
          <el-button @click="resetSearchForm('searchForm')">重置</el-button>
          <el-button @click="exportExcels(searchForm,'dealer/export','经销商管理')">导出</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div id="tableBox" style="margin:0 25px;">
      <el-table :data="tableData.data" border id='table'>
        <el-table-column label="经销商名称" min-width='200' fixed='left'>
          <template scope="scope">
            <span>{{ scope.row.name }}</span>
          </template>
        </el-table-column>

        <el-table-column label="使用者姓名" width='200' >
          <template scope="scope">
            <span>{{ scope.row.person }}</span>
          </template>
        </el-table-column>
        <el-table-column label="使用者手机号">
          <template scope="scope">
            <span>{{ scope.row.phone }}</span>
          </template>
        </el-table-column>
        <el-table-column label="手机号归属省市">
          <template scope="scope">
            <span>{{ scope.row.searchCity }}</span>
          </template>
        </el-table-column>
        <el-table-column label="用户来源">
          <template scope="scope">
            <span v-for="(index, item) in scope.row.dealerSourceVO" :key='index'>{{ item }}</span>
          </template>
        </el-table-column>
        <el-table-column label="补充资料有无">
          <template scope="scope">

            <span>{{ scope.row.dealerInfoId|showHaveOrNo }}</span>
          </template>
        </el-table-column>
        <el-table-column label="业务员">
          <template scope="scope">
            <span>{{ scope.row.realname }}</span>
          </template>
        </el-table-column>
        <el-table-column label="经销商类别">
          <template scope="scope">
            <span v-for="(index, item) in scope.row.dealerCategoryVO" :key='index'>{{ item }}</span>
          </template>
        </el-table-column>

        <el-table-column label="注册时间">
          <template scope="scope">
            <span>{{ scope.row.addDate | parseTime }}</span>
          </template>
        </el-table-column>
        <el-table-column label="实名认证时间">
          <template scope="scope">
            <span>{{ scope.row.realNameAuthenticationTime | parseTime }}</span>
          </template>
        </el-table-column>
        <el-table-column label="企业认证时间">
          <template scope="scope">
            <span>{{ scope.row.authenticationTime | parseTime }}</span>
          </template>
        </el-table-column>

        <el-table-column label="允许子账号数量">
          <template scope="scope">
            <span>{{ scope.row.subaccountsNumber }}</span>
          </template>
        </el-table-column>
          <el-table-column label="已有子账号数量">
          <template scope="scope">
            <span>{{ scope.row.existSubaccounts }}</span>
          </template>
        </el-table-column>
        <el-table-column label="是否启用">
          <template scope="scope">
            <span>{{ scope.row.enable |flagF }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" min-width='210' fixed='right'>
          <template scope="scope">
             <el-button style="margin-left:0;" size="small" @click="handleMessage(scope.$index, scope.row ,false )">企业信息</el-button>
            <el-button style="margin-left:0;" size="small" @click="handleBasic(scope.$index, scope.row ,false )">编辑</el-button>
            <el-button style="margin-left:0;" size="small" @click="handleSupple(scope.$index, scope.row,true)"> {{scope.row.dealerInfoId|showHaveOrNo('补录','变更')}}</el-button>
            <el-button style="margin-left:0;" size="small" @click="handleDisable(scope.$index, scope.row)" ref="flag">
              <!-- v-if="scope.row.enable" -->
              {{scope.row.enable | flag}}
            </el-button>
            <el-button style="margin-left:0;" size="small" @click="handleSee(scope.$index, scope.row)">
              查看
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-dialog title="基本资料管理" v-if="basicDialogFormVisible.dialogFormVisible" :visible.sync="basicDialogFormVisible.dialogFormVisible"
        :lock-scroll='true' top=5% :close-on-click-modal="false">
        <basicDialogForm v-on:refreshTableData="seachData()" v-bind:basicDialogFormVisible="basicDialogFormVisible" :tableData="tableData">
        </basicDialogForm>

      </el-dialog>
      <el-dialog v-if="suppleDialogFormVisible.dialogFormVisible" title="补充资料管理" :visible.sync="suppleDialogFormVisible.dialogFormVisible"
        :lock-scroll='true' top=5% :close-on-click-modal="false">
        <suppleDialogForm v-on:refreshTableData="seachData()" v-bind:suppleDialogFormVisible="suppleDialogFormVisible" :tableData="tableData"></suppleDialogForm>
      </el-dialog>

      <el-dialog v-if="openDialogFormVisible.dialogFormVisible" title="开户资料管理" :visible.sync="openDialogFormVisible.dialogFormVisible"
        :lock-scroll='true' top=5% :close-on-click-modal="false">
        <openDialogForm v-on:refreshTableData="seachData()" v-bind:openDialogFormVisible="openDialogFormVisible" :tableData="tableData"></openDialogForm>
      </el-dialog>
      <el-dialog v-if="salesmanDialogFormVisible.dialogFormVisible" title="更改人员绑定" :visible.sync="salesmanDialogFormVisible.dialogFormVisible"
        :lock-scroll='true' top=15% :close-on-click-modal="false">
        <salesmanDialogForm v-on:refreshTableData="seachData()" v-bind:salesmanDialogFormVisible="salesmanDialogFormVisible" :tableData="tableData"></salesmanDialogForm>
      </el-dialog>

      <el-dialog v-if="messageVisible.dialogFormVisible" title="企业信息" :visible.sync="messageVisible.dialogFormVisible"
        :lock-scroll='true' top=15% :close-on-click-modal="false">
          <MessAge v-on:refreshTableData="seachData()" v-bind:messageVisible="messageVisible"></MessAge>
      </el-dialog>
    </div>
    <div class="block" style="text-align: center;margin-top: 15px;position:relative;">
      <pagination v-on:refreshSeachData="seachData" :tableData="tableData" :searchForm="searchForm"></pagination>
      <el-button style="position: absolute;right: 150px;top: 0px;" type="primary" @click="handleBasic(null,null,true)">添加经销商</el-button>
      <el-button style="position: absolute;right: 25px;top: 0px;" type="primary" @click="changeSalesman(null,null,true)">更改人员绑定</el-button>
    </div>
  </div>
</template>
<script src="./index.js">


</script>
<style>
.el-popover,.el-popovers{
  height:800px !important ;
  overflow:scroll !important;
}
</style>


